package com.zhike.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.zhike.model.Project;
import com.zhike.model.Sample;
import com.zhike.model.Standard;
import com.zhike.service.SampleService;

@Controller
public class SampleController {
	
	@Autowired
	SampleService sampleService;
	
	/**
	 * 添加委托
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value="api/addEntrustment",method=RequestMethod.POST,produces="application/json;charset=utf-8")
	private String addSample(Sample sample) {
		String str	= sampleService.addEntrustment(sample);
		return str;
		
	}
	
	/**
	 * 委托列表
	 */
	@ResponseBody
	@RequestMapping(value="api/entrustmentList",method=RequestMethod.POST,produces="application/json;charset=utf-8")
	private String entrustmentList(Sample sample) {
		String str	= sampleService.entrustmentList(sample);
		return str;
		
	}
	
	/**
	 * 查看委托信息列表
	 */
	@ResponseBody
	@RequestMapping(value="api/sampleList",method=RequestMethod.POST,produces="application/json;charset=utf-8")
	private String sampleList(Sample sample) {
		String str	= sampleService.sampleList(sample);
		return str;
	}
	
	/**
	 * 样品列表
	 */
	@ResponseBody
	@RequestMapping(value="api/entrustment/examine",method=RequestMethod.POST,produces="application/json;charset=utf-8")
	private String entrustmentExamine(Sample sample) {
		String str	= sampleService.entrustmentExamine(sample);
		return str;
	}
	
	/**
	 * 检测项目列表1
	 */
	@ResponseBody
	@RequestMapping(value="api/standard/outer",method=RequestMethod.POST,produces="application/json;charset=utf-8")
	private String standardOut(Standard standard) {
		String str	= sampleService.standardOut(standard);
		return str;
	}
	/**
	 * 检测项目列表2
	 */
	@ResponseBody
	@RequestMapping(value="api/standard/middle",method=RequestMethod.POST,produces="application/json;charset=utf-8")
	private String standardMiddle(Standard standard) {
		String str	= sampleService.standardMiddle(standard);
		return str;
	}
	/**
	 * 检测项目列表3
	 */
	@ResponseBody
	@RequestMapping(value="api/standard/inner",method=RequestMethod.POST,produces="application/json;charset=utf-8")
	private String standardInner(Standard standard) {
		String str	= sampleService.standardInner(standard);
		return str;
	}
	/**
	 * 保存样品信息
	 */
	@ResponseBody
	@RequestMapping(value="api/sample/message",method=RequestMethod.POST,produces="application/json;charset=utf-8")
	private String sampleMessage(Sample sample) {
		String str	= sampleService.sampleMessage(sample);
		return str;
	}
	
	/**
	 * 样品领用
	 */
	@ResponseBody
	@RequestMapping(value="api/sampleGet",method=RequestMethod.POST,produces="application/json;charset=utf-8")
	private String sampleGet(Sample sample) {
		String str	= sampleService.sampleUse(sample);
		return str;
	}
	
	/**
	 * 只查各种状态的样品列表
	 */
	@ResponseBody
	@RequestMapping(value="api/sampleListByState",method=RequestMethod.POST,produces="application/json;charset=utf-8")
	private String sampleStateOne(Sample sample) {
		String str	= sampleService.sampleStateOne(sample);
		return str;
	}
	/**
	 * 样品留置
	 */
	@ResponseBody
	@RequestMapping(value="api/sampleLien",method=RequestMethod.POST,produces="application/json;charset=utf-8")
	private String sampleLien (Sample sample) {
		String str	= sampleService.sampleEmploy(sample);
		return str;
	}
	
	/**
	 * 样品处理
	 */
	@ResponseBody
	@RequestMapping(value="api/sampleManage",method=RequestMethod.POST,produces="application/json;charset=utf-8")
	private String sampleManage (Sample sample) {
		String str	= sampleService.sampleManage(sample);
		return str;
	}
	
	/**
	 * 项目立项
	 */
	@ResponseBody
	@RequestMapping(value="api/project/approval",method=RequestMethod.POST,produces="application/json;charset=utf-8")
	private String projectApproval (Project project) {
		String str	= sampleService.projectApproval(project);
		return str;
	}
	
	
	/**
	 * 项目列表
	 */
	@ResponseBody
	@RequestMapping(value="api/project/list",method=RequestMethod.POST,produces="application/json;charset=utf-8")
	private String projectList(Project project) {
		String str	= sampleService.projectList(project);
		return str;
	}
}
